//选择地址
//$("#city-picker").cityPicker({
//				toolbarTemplate:"<header class='bar bar-nav'>\
//		    <button class='button button-link pull-right close-picker'>确定</button>\
//		    </header>"
//		  });
//		  
		  
//		  $("#datetime-picker").datetimePicker({
// 		 		value: ['1985', '12', '04']
// 			 });





////生日
$(function () {  
		      
		        $('.birthInput').mobiscroll().date({  
		            theme: 'mobiscroll',  
		            display: 'bottom' ,
		            lang:"zh"
		        });  
		      
		        $('.birthBox').click(function () {  
		            $('.birthInput').mobiscroll('show');  
		            return false;  
		        });  
		      

		   });  
////性别	    
$(function () {  
    $("#treelist").mobiscroll().treelist({  
        theme: "android-ics light", 
        display:"bottom",
        lang: "zh",  
        defaultValue: [Math.floor($('#treelist li').length/2)],  
        formatResult: function (array) { //返回自定义格式结果  
            return $('#treelist>li').eq(array[0]).text()
        }  
    });  
})   
////点击允许邮寄刊物
var slideBol=true;
$(".postJournalSure").click(function(){
	if (slideBol) {
		//向右滑
		$(".postJournalSure>div").removeClass("postJournalSlideToLeft");
		$(".postJournalSure>div").addClass("postJournalSlideToRight");
		$(".postJournalSure").css("backgroundColor","rgb(179,144,0)");
		slideBol=false;
	}else{
		//向左滑
		$(".postJournalSure>div").removeClass("postJournalSlideToRight");
		$(".postJournalSure>div").addClass("postJournalSlideToLeft");
		$(".postJournalSure").css("backgroundColor","rgb(88,89,66)");
		slideBol=true;
	}
})
//////点击会员章程
var rulesBol=true;
$(".linkMemberContent").click(function(){
	$(".memberContent").show();
	//点击同意会员章程
	$(".agreeBtn").click(function(){
		$(".memberContent").hide();
		$(".rulesImg").attr("src","img/right.png");
		rulesBol=false;
	})
})
//////点击会员章程前面的同意的图片
$(".rulesImg").click(function(){
	if (rulesBol) {
		$(".rulesImg").attr("src","img/right.png");
		rulesBol=false;
	} else{
		$(".rulesImg").attr("src","img/isOK.png");
		rulesBol=true;
	}
})




var province="";
    	var city="";
		var Three="";
		var num=0;
    for (var i in cities) {
	city="";
	for (var j in cities[i]) {
		Three="";
		for (var f=0;f<cities[i][j].length;f++) {
			num++;
			Three+='<li data-value="'+num+'">'+cities[i][j][f]+'</li>';	
		}
		num++;
		city+='<li><span data-value="'+num+'">'+j+'</span><ul class="threeClass">'+Three+'</ul></li>';	
	}
	num++;
	province+='<li><div data-value="'+num+'">'+i+'</div><ul  class="cityClass">'+city+'</ul></li>';
}
$(".areaAll").append(province);
    	    	
    $("#current-area").click(function() {
        var that = this;
        $("#current-area-list").mobiscroll().treelist({
            theme: "android-ics",
            lang: "zh",
            display: 'bottom',
            inputClass: 'tmp',
            headerText: '请您选择',
            onSelect: function(valueText, inst) {
                var n = inst.getValue();
                var $list=$(this).children("li").eq(n[0]);
                var m1_id = $list.find("div").attr("data-value");
                var m2_id = $list.find("span").eq(n[1]).attr("data-value");
                var m3_id = $list.find("span").eq(n[1]).next().find('li').eq(n[2]).attr("data-value");
                var value =  valueText.split('/');             
                console.log(valueText,m1_id,value[0],m2_id,value[1],m3_id,value[2]);
              
                /*$.post("inc/person.org.php", {apart: "resume_base", current_area: m1+m2, current_areaPID: m1_id, current_areaCID: m2_id}, function (result) {
                    if (result == 'ok') {
                        $(that).find(".mbase-menu-txt").html(m1+m2);
                    }
                    else {
                        error('网络繁忙，请您稍后再试');
                    }
                });*/
                //后端处理部分
            },
            formatResult: function (data) {
                //自定义输出内容
                var $div = $("#current-area-list").children("li").eq(data[0]);   
                return $div.find('div').text() + '/' + $div.find('span').eq(data[1]).text()+ '/'+ $div.find('span').eq(data[1]).next().find('li').eq(data[2]).text();
            }
        });
        $("input[id^=current-area-list]").focus();
    });
